(function(){"use strict";BX.namespace("BX.Landing.UI.Field");var i=BX.Landing.Utils.isFunction;var n=BX.Landing.Utils.isBoolean;var a=BX.Landing.Utils.bind;var t=BX.Landing.Utils.escapeHtml;var e=BX.Landing.Utils.fireCustomEvent;var s=BX.Landing.Utils.addClass;var l=BX.Landing.Utils.removeClass;var d=BX.Landing.Utils.toggleClass;var h=BX.Landing.Utils.create;var c=BX.Landing.Utils.append;var o=BX.Landing.Utils.random;var r=BX.Landing.Utils.join;BX.Landing.UI.Field.Switch=function(n){BX.Landing.UI.Field.BaseField.apply(this,arguments);s(this.layout,"landing-ui-field-switch");this.value=n.value;this.id=r("switch_",o());this.onValueChangeHandler=i(n.onValueChange)?n.onValueChange:function(){};this.label=h("label",{props:{className:"landing-ui-field-switch-label"},attrs:{for:this.id},html:this.title});this.checkbox=h("input",{props:{className:"landing-ui-field-switch-checkbox"},attrs:{type:"checkbox",id:this.id}});this.slider=h("div",{props:{className:"landing-ui-field-switch-slider"}});c(this.checkbox,this.label);c(this.slider,this.label);c(this.label,this.input);this.setValue(this.value);a(this.checkbox,"change",this.onChange.bind(this))};BX.Landing.UI.Field.Switch.prototype={constructor:BX.Landing.UI.Field.Switch,__proto__:BX.Landing.UI.Field.BaseField.prototype,onChange:function(){this.onValueChangeHandler()},setValue:function(i){if(!n(i)){i=i==="true"}this.checkbox.checked=i},getValue:function(){return!!this.checkbox.checked}}})();